package com.lantosec.hmrp.modules.morality.mapper;

import com.lantosec.hmrp.core.kit.PageVO;
import com.lantosec.hmrp.modules.eval.vo.EvalItemVO;
import com.lantosec.hmrp.modules.eval.vo.EvalTaskEventVO;
import com.lantosec.hmrp.modules.morality.entity.MoralityCycle;
import com.lantosec.hmrp.modules.morality.entity.MoralityNote;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lantosec.hmrp.modules.morality.vo.MoralityNoteSelfVO;
import com.lantosec.hmrp.modules.morality.vo.MoralityNoteVO;
import com.lantosec.hmrp.modules.system.entity.SysDept;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 考评记录 Mapper 接口
 * </p>
 *
 * @author AutoCode
 * @since 2020-04-20
 */
public interface MoralityNoteMapper extends BaseMapper<MoralityNote> {

    /**
     * 查询考评记录考评对象的父类项目
     * @param moralityNoteId
     * @param moralityTargetId
     * @return
     */
    List<MoralityNoteSelfVO> getMoralityNoteSelf(@Param("moralityNoteId") Integer moralityNoteId, @Param("moralityTargetId") String moralityTargetId,
                                                @Param("moralityPlanId") Integer moralityPlanId);

    /**
     * 查询考评记录考评对象的子类项目
     * @param moralityNoteId
     * @param moralityTargetId
     * @return
     */
    List<MoralityNoteSelfVO> getMoralityNoteSelf1(@Param("moralityNoteId") Integer moralityNoteId, @Param("moralityTargetId") String moralityTargetId,
                                                  @Param("moralityPlanId") Integer moralityPlanId, @Param("moralityItemId") String moralityItemId);

    /**
     * 查询考评记录基本信息
     * @param page
     * @return
     */
    List<MoralityNoteVO> getMoralityNote(PageVO<MoralityNoteVO> page,@Param("moralityTargetId") String moralityTargetId,@Param("state") Integer state,
                                         @Param("moralityPlanName") String moralityPlanName);

    /**
     * 查询被考评人所在科室
     * @param moralityTargetId
     * @return
     */
    SysDept getDeptById(@Param("moralityTargetId") String moralityTargetId);

    /**
     * 查询考评方案的考评周期加减分开始结束时间
     * @param moralityPlanId
     * @return
     */
    MoralityCycle getMoralityCycle(@Param("moralityPlanId") Integer moralityPlanId);

    /**
     * 科室未审核列表
     * @param page
     * @param userId
     * @return
     */
    List<MoralityNoteVO> getDeptNotExamine(PageVO<MoralityNoteVO> page, @Param("userId") String userId,@Param("userName") String userName,
                                           @Param("moralityPlanName") String moralityPlanName);

    /**
     * 科室审核列表(医生)
     * @param page
     * @return
     */
    List<MoralityNoteVO> getDeptExamineDoc(PageVO<MoralityNoteVO> page);

    /**
     * 科室审核列表(护士)
     * @param page
     * @return
     */
    List<MoralityNoteVO> getDeptExamineNur(PageVO<MoralityNoteVO> page);

    /**
     * 党支部审核列表
     * @param page
     * @return
     */
    List<MoralityNoteVO> getPartyBranchExamine(PageVO<MoralityNoteVO> page,@Param("userName") String userName,@Param("deptId") String deptId,
                                               @Param("branchId") String branchId,@Param("moralityPlanName") String moralityPlanName);

    /**
     * 考评委员会审核列表
     * @param page
     * @return
     */
    List<MoralityNoteVO> getAppraisalExamine(PageVO<MoralityNoteVO> page,@Param("moralityPlanName") String moralityPlanName,
                                             @Param("userName") String userName,@Param("deptId") String deptId);

    /**
     * 查询当前用户的加减法项目
     * @param rewardStartDate
     * @param rewardEndDate
     * @param userId
     * @return
     */
    List<EvalItemVO> getMoralityItem(@Param("rewardStartDate") String rewardStartDate, @Param("rewardEndDate") String rewardEndDate,
                                     @Param("userId") String userId,@Param("moralityPlanId") Integer moralityPlanId);

    /**
     * 查询没有父类项目且为末级的项目
     * @param moralityNoteId
     * @param moralityTargetId
     * @param moralityPlanId
     * @return
     */
    List<MoralityNoteSelfVO> getMoralityNoteSelf2(@Param("moralityNoteId") Integer moralityNoteId, @Param("moralityTargetId") String moralityTargetId,
                                                  @Param("moralityPlanId") Integer moralityPlanId);

    /**
     * 查询部门的党支部id
     * @param deptIds
     * @return
     */
    String getMoralityBranchDept(String deptIds);
}
